package com.gientecher.register.controller;

import com.gientecher.register.entity.ClientEntity;
import com.gientecher.register.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RegisterController {

    @Autowired
    private RegisterService registerService;

    /***
     * 服务注册接口
     * @param clientEntity
     * @return
     */
    @PostMapping("/register")
    public ClientEntity register(@RequestBody ClientEntity clientEntity){
        registerService.doRegister(clientEntity);
        return clientEntity;
    }

    //获取服务列表
    @GetMapping("/services")
    public List<ClientEntity> services(){
        return registerService.getServices();
    }

}
